<?php

require_once __DIR__ . '/vendor/autoload.php';

use support\Db;
use app\model\CardModel;
use app\model\CardTopicOrderModel;
use app\model\CardItemModel;
use app\model\CardUserModel;

// 测试数据库连接
try {
    // 测试查询主题卡
    $card = CardModel::where('type', 'topic')->first();
    if ($card) {
        echo "找到主题卡: " . $card->name . "\n";
        echo "价格: " . $card->price . "\n";
        echo "福豆: " . $card->score . "\n";
    } else {
        echo "没有找到主题卡\n";
    }

    // 测试CardTopicOrderModel
    $order = new CardTopicOrderModel();
    echo "CardTopicOrderModel 创建成功\n";

    // 测试CardItemModel
    $cardItem = new CardItemModel();
    echo "CardItemModel 创建成功\n";

    // 测试CardUserModel
    $cardUser = new CardUserModel();
    echo "CardUserModel 创建成功\n";

    echo "所有模型测试通过\n";

} catch (Exception $e) {
    echo "错误: " . $e->getMessage() . "\n";
} 